<!DOCTYPE html><html><head>
      <title>RSA&#x5BC6;&#x7801;&#x5B66;&#x89C4;&#x8303;PKCS1_v_2_2</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      
      
        <script type="text/x-mathjax-config">
          MathJax.Hub.Config({"extensions":["tex2jax.js"],"jax":["input/TeX","output/HTML-CSS"],"messageStyle":"none","tex2jax":{"processEnvironments":false,"processEscapes":true,"inlineMath":[["$","$"],["\\(","\\)"]],"displayMath":[["$$","$$"],["\\[","\\]"]]},"TeX":{"extensions":["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]},"HTML-CSS":{"availableFonts":["TeX"]}});
        </script>
        <script type="text/javascript" async src="file:///c:\Users\Lenovo\.vscode\extensions\shd101wyy.markdown-preview-enhanced-0.5.13\node_modules\@shd101wyy\mume\dependencies\mathjax\MathJax.js" charset="UTF-8"></script>
        
      
      
      
      
      
      
      
      
      
      <style>
      /**
 * prism.js Github theme based on GitHub's theme.
 * @author Sam Clarke
 */
code[class*="language-"],
pre[class*="language-"] {
  color: #333;
  background: none;
  font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.4;

  -moz-tab-size: 8;
  -o-tab-size: 8;
  tab-size: 8;

  -webkit-hyphens: none;
  -moz-hyphens: none;
  -ms-hyphens: none;
  hyphens: none;
}

/* Code blocks */
pre[class*="language-"] {
  padding: .8em;
  overflow: auto;
  /* border: 1px solid #ddd; */
  border-radius: 3px;
  /* background: #fff; */
  background: #f5f5f5;
}

/* Inline code */
:not(pre) > code[class*="language-"] {
  padding: .1em;
  border-radius: .3em;
  white-space: normal;
  background: #f5f5f5;
}

.token.comment,
.token.blockquote {
  color: #969896;
}

.token.cdata {
  color: #183691;
}

.token.doctype,
.token.punctuation,
.token.variable,
.token.macro.property {
  color: #333;
}

.token.operator,
.token.important,
.token.keyword,
.token.rule,
.token.builtin {
  color: #a71d5d;
}

.token.string,
.token.url,
.token.regex,
.token.attr-value {
  color: #183691;
}

.token.property,
.token.number,
.token.boolean,
.token.entity,
.token.atrule,
.token.constant,
.token.symbol,
.token.command,
.token.code {
  color: #0086b3;
}

.token.tag,
.token.selector,
.token.prolog {
  color: #63a35c;
}

.token.function,
.token.namespace,
.token.pseudo-element,
.token.class,
.token.class-name,
.token.pseudo-class,
.token.id,
.token.url-reference .token.variable,
.token.attr-name {
  color: #795da3;
}

.token.entity {
  cursor: help;
}

.token.title,
.token.title .token.punctuation {
  font-weight: bold;
  color: #1d3e81;
}

.token.list {
  color: #ed6a43;
}

.token.inserted {
  background-color: #eaffea;
  color: #55a532;
}

.token.deleted {
  background-color: #ffecec;
  color: #bd2c00;
}

.token.bold {
  font-weight: bold;
}

.token.italic {
  font-style: italic;
}


/* JSON */
.language-json .token.property {
  color: #183691;
}

.language-markup .token.tag .token.punctuation {
  color: #333;
}

/* CSS */
code.language-css,
.language-css .token.function {
  color: #0086b3;
}

/* YAML */
.language-yaml .token.atrule {
  color: #63a35c;
}

code.language-yaml {
  color: #183691;
}

/* Ruby */
.language-ruby .token.function {
  color: #333;
}

/* Markdown */
.language-markdown .token.url {
  color: #795da3;
}

/* Makefile */
.language-makefile .token.symbol {
  color: #795da3;
}

.language-makefile .token.variable {
  color: #183691;
}

.language-makefile .token.builtin {
  color: #0086b3;
}

/* Bash */
.language-bash .token.keyword {
  color: #0086b3;
}

/* highlight */
pre[data-line] {
  position: relative;
  padding: 1em 0 1em 3em;
}
pre[data-line] .line-highlight-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  background-color: transparent;
  display: block;
  width: 100%;
}

pre[data-line] .line-highlight {
  position: absolute;
  left: 0;
  right: 0;
  padding: inherit 0;
  margin-top: 1em;
  background: hsla(24, 20%, 50%,.08);
  background: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
  pointer-events: none;
  line-height: inherit;
  white-space: pre;
}

pre[data-line] .line-highlight:before, 
pre[data-line] .line-highlight[data-end]:after {
  content: attr(data-start);
  position: absolute;
  top: .4em;
  left: .6em;
  min-width: 1em;
  padding: 0 .5em;
  background-color: hsla(24, 20%, 50%,.4);
  color: hsl(24, 20%, 95%);
  font: bold 65%/1.5 sans-serif;
  text-align: center;
  vertical-align: .3em;
  border-radius: 999px;
  text-shadow: none;
  box-shadow: 0 1px white;
}

pre[data-line] .line-highlight[data-end]:after {
  content: attr(data-end);
  top: auto;
  bottom: .4em;
}html body{font-family:"Helvetica Neue",Helvetica,"Segoe UI",Arial,freesans,sans-serif;font-size:16px;line-height:1.6;color:#333;background-color:#fff;overflow:initial;box-sizing:border-box;word-wrap:break-word}html body>:first-child{margin-top:0}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{line-height:1.2;margin-top:1em;margin-bottom:16px;color:#000}html body h1{font-size:2.25em;font-weight:300;padding-bottom:.3em}html body h2{font-size:1.75em;font-weight:400;padding-bottom:.3em}html body h3{font-size:1.5em;font-weight:500}html body h4{font-size:1.25em;font-weight:600}html body h5{font-size:1.1em;font-weight:600}html body h6{font-size:1em;font-weight:600}html body h1,html body h2,html body h3,html body h4,html body h5{font-weight:600}html body h5{font-size:1em}html body h6{color:#5c5c5c}html body strong{color:#000}html body del{color:#5c5c5c}html body a:not([href]){color:inherit;text-decoration:none}html body a{color:#08c;text-decoration:none}html body a:hover{color:#00a3f5;text-decoration:none}html body img{max-width:100%}html body>p{margin-top:0;margin-bottom:16px;word-wrap:break-word}html body>ul,html body>ol{margin-bottom:16px}html body ul,html body ol{padding-left:2em}html body ul.no-list,html body ol.no-list{padding:0;list-style-type:none}html body ul ul,html body ul ol,html body ol ol,html body ol ul{margin-top:0;margin-bottom:0}html body li{margin-bottom:0}html body li.task-list-item{list-style:none}html body li>p{margin-top:0;margin-bottom:0}html body .task-list-item-checkbox{margin:0 .2em .25em -1.8em;vertical-align:middle}html body .task-list-item-checkbox:hover{cursor:pointer}html body blockquote{margin:16px 0;font-size:inherit;padding:0 15px;color:#5c5c5c;background-color:#f0f0f0;border-left:4px solid #d6d6d6}html body blockquote>:first-child{margin-top:0}html body blockquote>:last-child{margin-bottom:0}html body hr{height:4px;margin:32px 0;background-color:#d6d6d6;border:0 none}html body table{margin:10px 0 15px 0;border-collapse:collapse;border-spacing:0;display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all}html body table th{font-weight:bold;color:#000}html body table td,html body table th{border:1px solid #d6d6d6;padding:6px 13px}html body dl{padding:0}html body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:bold}html body dl dd{padding:0 16px;margin-bottom:16px}html body code{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;font-size:.85em !important;color:#000;background-color:#f0f0f0;border-radius:3px;padding:.2em 0}html body code::before,html body code::after{letter-spacing:-0.2em;content:"\00a0"}html body pre>code{padding:0;margin:0;font-size:.85em !important;word-break:normal;white-space:pre;background:transparent;border:0}html body .highlight{margin-bottom:16px}html body .highlight pre,html body pre{padding:1em;overflow:auto;font-size:.85em !important;line-height:1.45;border:#d6d6d6;border-radius:3px}html body .highlight pre{margin-bottom:0;word-break:normal}html body pre code,html body pre tt{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}html body pre code:before,html body pre tt:before,html body pre code:after,html body pre tt:after{content:normal}html body p,html body blockquote,html body ul,html body ol,html body dl,html body pre{margin-top:0;margin-bottom:16px}html body kbd{color:#000;border:1px solid #d6d6d6;border-bottom:2px solid #c7c7c7;padding:2px 4px;background-color:#f0f0f0;border-radius:3px}@media print{html body{background-color:#fff}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{color:#000;page-break-after:avoid}html body blockquote{color:#5c5c5c}html body pre{page-break-inside:avoid}html body table{display:table}html body img{display:block;max-width:100%;max-height:100%}html body pre,html body code{word-wrap:break-word;white-space:pre}}.markdown-preview{width:100%;height:100%;box-sizing:border-box}.markdown-preview .pagebreak,.markdown-preview .newpage{page-break-before:always}.markdown-preview pre.line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}.markdown-preview pre.line-numbers>code{position:relative}.markdown-preview pre.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:1em;font-size:100%;left:0;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.markdown-preview pre.line-numbers .line-numbers-rows>span{pointer-events:none;display:block;counter-increment:linenumber}.markdown-preview pre.line-numbers .line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}.markdown-preview .mathjax-exps .MathJax_Display{text-align:center !important}.markdown-preview:not([for="preview"]) .code-chunk .btn-group{display:none}.markdown-preview:not([for="preview"]) .code-chunk .status{display:none}.markdown-preview:not([for="preview"]) .code-chunk .output-div{margin-bottom:16px}.scrollbar-style::-webkit-scrollbar{width:8px}.scrollbar-style::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}.scrollbar-style::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode]){position:relative;width:100%;height:100%;top:0;left:0;margin:0;padding:0;overflow:auto}html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{position:relative;top:0}@media screen and (min-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em calc(50% - 457px + 2em)}}@media screen and (max-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{font-size:14px !important;padding:1em}}@media print{html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{display:none}}html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{position:fixed;bottom:8px;left:8px;font-size:28px;cursor:pointer;color:inherit;z-index:99;width:32px;text-align:center;opacity:.4}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] #sidebar-toc-btn{opacity:1}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc{position:fixed;top:0;left:0;width:300px;height:100%;padding:32px 0 48px 0;font-size:14px;box-shadow:0 0 4px rgba(150,150,150,0.33);box-sizing:border-box;overflow:auto;background-color:inherit}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar{width:8px}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc a{text-decoration:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{padding:0 1.6em;margin-top:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc li{margin-bottom:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{list-style-type:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{left:300px;width:calc(100% -  300px);padding:2em calc(50% - 457px -  150px);margin:0;box-sizing:border-box}@media screen and (max-width:1274px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{width:100%}}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .markdown-preview{left:50%;transform:translateX(-50%)}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .md-sidebar-toc{display:none}
/* Please visit the URL below for more information: */
/*   https://shd101wyy.github.io/markdown-preview-enhanced/#/customize-css */

      </style>
    </head>
    <body for="html-export">
      <div class="mume markdown-preview  ">
      <h1 class="mume-header" id="rsa%E5%AF%86%E7%A0%81%E5%AD%A6%E8%A7%84%E8%8C%83pkcs1-v22">RSA&#x5BC6;&#x7801;&#x5B66;&#x89C4;&#x8303;PKCS#1 v2.2</h1>

<p><span id="toc"></span></p>
<ul>
<li><a href="#rsa%E5%AF%86%E7%A0%81%E5%AD%A6%E8%A7%84%E8%8C%83pkcs1-v22">RSA&#x5BC6;&#x7801;&#x5B66;&#x89C4;&#x8303;PKCS#1 v2.2</a>
<ul>
<li><a href="#%E7%AC%A6%E5%8F%B7%E8%AF%B4%E6%98%8Etoc">&#x7B26;&#x53F7;&#x8BF4;&#x660E;</a>
<ul>
<li><a href="#%E5%85%AC%E9%92%A5%E7%A7%81%E9%92%A5%E7%9A%84%E8%A1%A8%E7%A4%BAtoc">&#x516C;&#x94A5;&#x79C1;&#x94A5;&#x7684;&#x8868;&#x793A;</a></li>
</ul>
</li>
<li><a href="#%E6%95%B0%E6%8D%AE%E8%BD%AC%E6%8D%A2toc">&#x6570;&#x636E;&#x8F6C;&#x6362;</a>
<ul>
<li><a href="#i2osptoc">I2OSP</a></li>
<li><a href="#osp2iptoc">OSP2IP</a></li>
</ul>
</li>
<li><a href="#%E5%AF%86%E7%A0%81%E5%AD%A6%E5%8E%9F%E8%AF%ADtoc">&#x5BC6;&#x7801;&#x5B66;&#x539F;&#x8BED;</a>
<ul>
<li><a href="#%E5%8A%A0%E5%AF%86rsaeptoc">&#x52A0;&#x5BC6;RSAEP</a></li>
<li><a href="#%E8%A7%A3%E5%AF%86rsadptoc">&#x89E3;&#x5BC6;RSADP</a></li>
<li><a href="#%E7%AD%BE%E5%90%8Drsasp1toc">&#x7B7E;&#x540D;RSASP1</a></li>
<li><a href="#%E9%AA%8C%E8%AF%81rsavp1toc">&#x9A8C;&#x8BC1;RSAVP1</a></li>
</ul>
</li>
<li><a href="#%E5%8A%A0%E5%AF%86%E6%96%B9%E6%A1%88toc">&#x52A0;&#x5BC6;&#x65B9;&#x6848;</a>
<ul>
<li><a href="#rsaes-oaeptoc">RSAES-OAEP</a>
<ul>
<li><a href="#rsaes-oaep-encrypttoc">RSAES-OAEP-Encrypt</a></li>
<li><a href="#rsaes-oaep-decrypttoc">RSAES-OAEP-Decrypt</a></li>
</ul>
</li>
<li><a href="#rsaes-pkcs1_v15toc">RSAES-PKCS1_v1.5</a>
<ul>
<li><a href="#rsaes-pkcs1_v15-encrypttoc">RSAES-PKCS1_v1.5-Encrypt</a></li>
<li><a href="#rsaes-pkcs_v15-decrypttoc">RSAES-PKCS_v1.5-Decrypt</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#%E7%AD%BE%E5%90%8D%E6%96%B9%E6%A1%88toc">&#x7B7E;&#x540D;&#x65B9;&#x6848;</a>
<ul>
<li><a href="#rsassa-psstoc">RSASSA-PSS</a>
<ul>
<li><a href="#rsassa-pss-signtoc">RSASSA-PSS-Sign</a></li>
<li><a href="#rsassa-pss-verifytoc">RSASSA-PSS-Verify</a></li>
</ul>
</li>
<li><a href="#rsassa-pkcs1-v15toc">RSASSA-PKCS1-v1.5</a>
<ul>
<li><a href="#rsassa-pkcs1-v15-signtoc">RSASSA-PKCS1-v1.5-Sign</a></li>
<li><a href="#rsassa-pkcs1-v15-verifytoc">RSASSA-PKCS1-v1.5-Verify</a></li>
</ul>
</li>
<li><a href="#emsa-psstoc">EMSA-PSS</a>
<ul>
<li><a href="#emsa-pss-encodetoc">EMSA-PSS-Encode</a></li>
<li><a href="#emsa-pss-verifytoc">EMSA-PSS-Verify</a></li>
</ul>
</li>
<li><a href="#emsa-pkcs1-v15toc">EMSA-PKCS1-v1.5</a>
<ul>
<li><a href="#emsa-pkcs1-v15-encodetoc">EMSA-PKCS1-v1.5-Encode</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#mgftoc">MGF</a></li>
<li><a href="#%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99toc">&#x53C2;&#x8003;&#x8D44;&#x6599;</a></li>
</ul>
</li>
</ul>
<h2 class="mume-header" id="%E7%AC%A6%E5%8F%B7%E8%AF%B4%E6%98%8Etoc"><a href="#toc">&#x7B26;&#x53F7;&#x8BF4;&#x660E;</a></h2>

<ul>
<li><span class="mathjax-exps">$n$</span>: RSA&#x6A21;&#x6570;<span class="mathjax-exps">$n$</span>;</li>
<li><span class="mathjax-exps">$r_i$</span>: &#x6A21;&#x6570;<span class="mathjax-exps">$n$</span>&#x7684;&#x7D20;&#x56E0;&#x5B50;(&#x9700;&#x662F;&#x5947;&#x7D20;&#x6570;), <span class="mathjax-exps">$n=r_1\cdot r_2\cdot \dots\cdot r_u, u \ge 2$</span>;</li>
<li><span class="mathjax-exps">$p,q$</span>: <span class="mathjax-exps">$n$</span>&#x7684;&#x7D20;&#x56E0;&#x5B50;, &#x6EE1;&#x8DB3;<span class="mathjax-exps">$n=p\cdot q$</span>. &#x5176;&#x4E2D;<span class="mathjax-exps">$r_1=p, r_2 = q$</span>;</li>
<li><span class="mathjax-exps">$C$</span>: &#x5BC6;&#x6587;&#x7684;&#x516B;&#x4F4D;&#x4E32;&#x5B57;&#x7B26;&#x4E32;&#x8868;&#x793A;;</li>
<li><span class="mathjax-exps">$c$</span>: &#x5BC6;&#x6587;&#x7684;&#x6574;&#x6570;&#x8868;&#x793A;, <span class="mathjax-exps">$0\le c \le (n-1)$</span>;</li>
<li><span class="mathjax-exps">$m$</span>: &#x6D88;&#x606F;&#x7684;&#x6574;&#x6570;&#x8868;&#x793A;, <span class="mathjax-exps">$0\le m \le (n-1)$</span>;</li>
<li><span class="mathjax-exps">$M$</span>: &#x6D88;&#x606F;&#x7684;&#x516B;&#x4F4D;&#x4E32;(&#x6BCF;8&#x4F4D;&#x4E00;&#x7EC4;)&#x5B57;&#x7B26;&#x4E32;&#x8868;&#x793A;;</li>
<li><span class="mathjax-exps">$s$</span>: &#x7B7E;&#x540D;&#x7684;&#x6574;&#x6570;&#x8868;&#x793A;, <span class="mathjax-exps">$0\le s \le (n-1)$</span>;</li>
<li><span class="mathjax-exps">$S$</span>: &#x7B7E;&#x540D;&#x7684;&#x516B;&#x4F4D;&#x4E32;&#x5B57;&#x7B26;&#x4E32;&#x8868;&#x793A;;</li>
<li><span class="mathjax-exps">$d$</span>: &#x79C1;&#x94A5;&#x6307;&#x6570;,  <span class="mathjax-exps">$e\cdot d \equiv 1\mod \lambda(n)$</span>;</li>
<li><span class="mathjax-exps">$e$</span>: &#x516C;&#x94A5;&#x6307;&#x6570;, <span class="mathjax-exps">$3 \le e \le (n-1), GCD(e, \lambda(n))=1$</span>;</li>
<li><span class="mathjax-exps">$EM$</span>: &#x7ECF;&#x8FC7;&#x4E00;&#x5B9A;&#x7F16;&#x7801;&#x89C4;&#x5219;&#x7684;&#x6D88;&#x606F;&#x4E32;, &#x516B;&#x8FDB;&#x5236;&#x516B;&#x4F4D;&#x4E32;&#x5B57;&#x7B26;&#x4E32;;</li>
<li><span class="mathjax-exps">$d_i$</span>: &#x7D20;&#x56E0;&#x5B50;<span class="mathjax-exps">$r_i$</span>&#x7684;CRT&#x6307;&#x6570;, <span class="mathjax-exps">$e\cdot d_i\equiv 1 \mod (r_i-1), i=3,\dots, u$</span>;</li>
<li><span class="mathjax-exps">$dP$</span>: <span class="mathjax-exps">$p$</span>&#x7684;CRT&#x6307;&#x6570;, <span class="mathjax-exps">$e\cdot dP \equiv 1\mod (p-1)$</span>;</li>
<li><span class="mathjax-exps">$dQ$</span>: <span class="mathjax-exps">$q$</span>&#x7684;CRT&#x6307;&#x6570;, <span class="mathjax-exps">$e\cdot dQ \equiv 1\mod (q-1)$</span>;</li>
<li><span class="mathjax-exps">$qInv$</span>: CRT&#x7CFB;&#x6570;, <span class="mathjax-exps">$q\cdot qInv\equiv 1\mod p,\ 0\lt qInv \lt p$</span>;</li>
<li><span class="mathjax-exps">$t_i$</span>: CRT&#x7CFB;&#x6570;, <span class="mathjax-exps">$R_i\cdot t_i\equiv 1\mod r_i, R_i=r_1\cdot r_2\cdot\dots\cdot r_{i-1}, i = 3,\dots,u$</span>;</li>
<li><span class="mathjax-exps">$\lambda(n)=LCM(r_1-1,r_2-1,\dots,r_u-1)$</span>;</li>
<li><span class="mathjax-exps">$a||b$</span>: &#x8868;&#x793A;&#x5C06;&#x5B57;&#x7B26;&#x4E32;<span class="mathjax-exps">$b$</span>&#x62FC;&#x63A5;&#x5728;<span class="mathjax-exps">$a$</span>&#x540E;;</li>
<li><span class="mathjax-exps">$len(X)$</span>&#x8868;&#x793A;&#x8BA1;&#x7B97;&#x516B;&#x4F4D;&#x4E32;&#x7684;&#x957F;&#x5EA6;, &#x5373;&#x5B57;&#x8282;&#x957F;&#x5EA6;;</li>
<li><span class="mathjax-exps">$truncate_l(X)$</span>&#x8868;&#x793A;&#x53D6;<span class="mathjax-exps">$X$</span>&#x7684;&#x6700;&#x5DE6;&#x8FB9;(&#x6700;&#x9AD8;&#x6709;&#x6548;&#x4F4D;)&#x7684;<span class="mathjax-exps">$l$</span>&#x4E2A;&#x5B57;&#x8282;. &#x5982;&#x679C;&#x4E0D;&#x8DB3;<span class="mathjax-exps">$l$</span>&#x4E2A;&#x5B57;&#x8282;&#x5219;&#x5728;&#x6700;&#x9AD8;&#x4F4D;&#x586B;&#x5145;0&#x8865;&#x9F50;&#x5230;<span class="mathjax-exps">$l$</span>&#x4E2A;&#x5B57;&#x8282;;</li>
</ul>
<h3 class="mume-header" id="%E5%85%AC%E9%92%A5%E7%A7%81%E9%92%A5%E7%9A%84%E8%A1%A8%E7%A4%BAtoc"><a href="#toc">&#x516C;&#x94A5;&#x79C1;&#x94A5;&#x7684;&#x8868;&#x793A;</a></h3>

<ul>
<li>
<p>&#x516C;&#x94A5;:</p>
<ul>
<li><span class="mathjax-exps">$(n,e)$</span>;</li>
</ul>
</li>
<li>
<p>&#x79C1;&#x94A5;:</p>
<ul>
<li>&#x7B2C;&#x4E00;&#x79CD;&#x79C1;&#x94A5;&#x8868;&#x793A;:
<ul>
<li><span class="mathjax-exps">$(n,d)$</span>;</li>
</ul>
</li>
<li>&#x7B2C;&#x4E8C;&#x79CD;&#x79C1;&#x94A5;&#x8868;&#x793A;:
<ul>
<li><span class="mathjax-exps">$(p,q,dP,dQ,qInv), (r_i, d_i, t_i)$</span>;</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2 class="mume-header" id="%E6%95%B0%E6%8D%AE%E8%BD%AC%E6%8D%A2toc"><a href="#toc">&#x6570;&#x636E;&#x8F6C;&#x6362;</a></h2>

<ul>
<li>I2OSP: &#x6574;&#x6570;&#x8F6C;&#x4E3A;&#x516B;&#x4F4D;&#x4E32;&#x5B57;&#x7B26;&#x4E32;;</li>
<li>OS2IP: &#x516B;&#x4F4D;&#x4E32;&#x5B57;&#x7B26;&#x4E32;&#x8F6C;&#x4E3A;&#x6574;&#x6570;;</li>
</ul>
<h3 class="mume-header" id="i2osptoc"><a href="#toc">I2OSP</a></h3>

<p>&#x8BB0;&#x6709;&#x5927;&#x6574;&#x6570;<span class="mathjax-exps">$x=\sum_{i=0}^{N-1}b_i\cdot 2^{8\cdot i}, N=len(x)$</span>, &#x5219;&#x5BF9;&#x5E94;&#x7684;&#x516B;&#x4F4D;&#x4E32;&#x5B57;&#x7B26;&#x4E32;&#x4E3A;<span class="mathjax-exps">$X=b_{N-1}||\dots||b_1||b_0$</span>;</p>
<h3 class="mume-header" id="osp2iptoc"><a href="#toc">OSP2IP</a></h3>

<p>&#x8BB0;&#x6709;&#x516B;&#x4F4D;&#x4E32;&#x5B57;&#x7B26;&#x4E32;&#x4E3A;<span class="mathjax-exps">$X=b_{N-1}||\dots||b_1||b_0$</span>, &#x5219;&#x5BF9;&#x5E94;&#x7684;&#x5927;&#x6574;&#x6570;&#x4E3A;<span class="mathjax-exps">$x=\sum_{i=0}^{N}b_i\cdot 2^{8\cdot i}, N=len(x)$</span>;</p>
<h2 class="mume-header" id="%E5%AF%86%E7%A0%81%E5%AD%A6%E5%8E%9F%E8%AF%ADtoc"><a href="#toc">&#x5BC6;&#x7801;&#x5B66;&#x539F;&#x8BED;</a></h2>

<h3 class="mume-header" id="%E5%8A%A0%E5%AF%86rsaeptoc"><a href="#toc">&#x52A0;&#x5BC6;RSAEP</a></h3>

<p></p><div class="mathjax-exps">$$c = m^e \mod n$$</div><p></p>
<h3 class="mume-header" id="%E8%A7%A3%E5%AF%86rsadptoc"><a href="#toc">&#x89E3;&#x5BC6;RSADP</a></h3>

<ul>
<li>&#x7B2C;&#x4E00;&#x79CD;&#x79C1;&#x94A5;&#x8868;&#x793A;:
<ul>
<li><span class="mathjax-exps">$m = c^d \mod n$</span>;</li>
</ul>
</li>
<li>&#x7B2C;&#x4E8C;&#x79CD;&#x79C1;&#x94A5;&#x8868;&#x793A;:
<ul>
<li><span class="mathjax-exps">$m_1 = c^{dP}\mod p, m_2 = c^{dQ}\mod q$</span>;</li>
<li><span class="mathjax-exps">$m_i = c^{d_i}\mod r_i, i=3,\dots,u$</span>;</li>
<li><span class="mathjax-exps">$h=(m_1 - m_2)\cdot qInv \mod p$</span>;</li>
<li><span class="mathjax-exps">$m = m_2 + q\cdot h$</span>;</li>
<li>&#x521D;&#x59CB;&#x5316;<span class="mathjax-exps">$T=r_1$</span>, <span class="mathjax-exps">$m = m + (T\cdot r_{i-1})\cdot ((m_i - m)\cdot t_i \mod r_i)\quad for\ i\ from\ 3\ to\ u$</span></li>
</ul>
</li>
</ul>
<h3 class="mume-header" id="%E7%AD%BE%E5%90%8Drsasp1toc"><a href="#toc">&#x7B7E;&#x540D;RSASP1</a></h3>

<ul>
<li>&#x7B2C;&#x4E00;&#x79CD;&#x79C1;&#x94A5;&#x8868;&#x793A;:
<ul>
<li><span class="mathjax-exps">$s=m^d \mod n$</span>;</li>
</ul>
</li>
<li>&#x7B2C;&#x4E8C;&#x79CD;&#x79C1;&#x94A5;&#x8868;&#x793A;:
<ul>
<li><span class="mathjax-exps">$s_1 = m^{dP}\mod p, s_2 = m^{dQ}\mod q$</span>;</li>
<li><span class="mathjax-exps">$s_i = m^{d_i} \mod r_i, i = 3,\dots,u$</span>;</li>
<li><span class="mathjax-exps">$h = (s_1 - s_2)\cdot qInv\mod p$</span>;</li>
<li><span class="mathjax-exps">$s = s_2 + q\cdot h$</span>;</li>
<li>&#x521D;&#x59CB;&#x5316;<span class="mathjax-exps">$T=r_1$</span>, <span class="mathjax-exps">$s = s + (T\cdot r_{i-1})\cdot ((s_i - s)\cdot t_i \mod r_i)\quad for\ i\ from\ 3\ to\ u$</span></li>
</ul>
</li>
</ul>
<h3 class="mume-header" id="%E9%AA%8C%E8%AF%81rsavp1toc"><a href="#toc">&#x9A8C;&#x8BC1;RSAVP1</a></h3>

<p></p><div class="mathjax-exps">$$m = s^e \mod n$$</div><p></p>
<h2 class="mume-header" id="%E5%8A%A0%E5%AF%86%E6%96%B9%E6%A1%88toc"><a href="#toc">&#x52A0;&#x5BC6;&#x65B9;&#x6848;</a></h2>

<h3 class="mume-header" id="rsaes-oaeptoc"><a href="#toc">RSAES-OAEP</a></h3>

<ul>
<li>&#x7B26;&#x53F7;&#x8BF4;&#x660E;:
<ul>
<li><span class="mathjax-exps">$L$</span>: &#x548C;&#x6D88;&#x606F;<span class="mathjax-exps">$M$</span>&#x76F8;&#x5173;&#x8054;&#x7684;&#x6807;&#x7B7E;, &#x9ED8;&#x8BA4;&#x4E3A;&#x7A7A;&#x5B57;&#x7B26;&#x4E32;;</li>
<li><span class="mathjax-exps">$MGF$</span>: &#x63A9;&#x7801;&#x751F;&#x6210;&#x51FD;&#x6570;(Mask Generation Function);</li>
</ul>
</li>
</ul>
<h4 class="mume-header" id="rsaes-oaep-encrypttoc"><a href="#toc">RSAES-OAEP-Encrypt</a></h4>

<ul>
<li>&#x68C0;&#x67E5;&#x957F;&#x5EA6;&#x662F;&#x5426;&#x6EE1;&#x8DB3;&#x4EE5;&#x4E0B;&#x8981;&#x6C42;:
<ul>
<li><span class="mathjax-exps">$len(L)$</span>&#x7684;&#x957F;&#x5EA6;&#x9700;&#x5C0F;&#x4E8E;Hash&#x51FD;&#x6570;&#x5BF9;&#x8F93;&#x5165;&#x516B;&#x4F4D;&#x4E32;&#x957F;&#x5EA6;&#x7684;&#x9650;&#x5236;;</li>
<li><span class="mathjax-exps">$len(M)\le len(n) - 2\cdot len(HashVal) - 2$</span>;</li>
</ul>
</li>
<li>EME-OAEP&#x7F16;&#x7801;:
<ul>
<li><span class="mathjax-exps">$lval = Hash(L)$</span>;</li>
<li>&#x751F;&#x6210;&#x516B;&#x4F4D;&#x4E32;&#x5B57;&#x7B26;&#x4E32;<span class="mathjax-exps">$PS=0||\dots||0,\ len(PS)=len(n)-len(M)-2\cdot len(HashVal) - 2$</span>;</li>
<li>&#x751F;&#x6210;&#x516B;&#x4F4D;&#x4E32;&#x5B57;&#x7B26;&#x4E32;<span class="mathjax-exps">$DB=lval || PS || 0x01 || M$</span>;</li>
<li>&#x751F;&#x6210;&#x516B;&#x4F4D;&#x4E32;&#x957F;&#x5EA6;&#x4E3A;<span class="mathjax-exps">$len(HashVal)$</span>&#x7684;&#x968F;&#x673A;&#x516B;&#x4F4D;&#x4E32;&#x5B57;&#x7B26;&#x4E32;<span class="mathjax-exps">$seed$</span>;</li>
<li><span class="mathjax-exps">$dbMask = MGF(seed, len(n)-len(HashVal)-1)$</span>;</li>
<li><span class="mathjax-exps">$maskedDB = DB \oplus dbMask$</span>;</li>
<li><span class="mathjax-exps">$seedMask = MGF(maskedDB, len(HashVal))$</span>;</li>
<li><span class="mathjax-exps">$maskSeed = seed \oplus seedMask$</span>;</li>
<li><span class="mathjax-exps">$EM = 0x00 || maskedSeed || maskedDB$</span>;</li>
</ul>
</li>
<li>RSA&#x52A0;&#x5BC6;:
<ul>
<li><span class="mathjax-exps">$m=OS2IP(EM)$</span>;</li>
<li><span class="mathjax-exps">$c = RSAEP(m)$</span>;</li>
<li><span class="mathjax-exps">$C = truncate_{len(n)}(I2OSP(c))$</span>;</li>
</ul>
</li>
<li>&#x8F93;&#x51FA;<span class="mathjax-exps">$C$</span>;</li>
</ul>
<h4 class="mume-header" id="rsaes-oaep-decrypttoc"><a href="#toc">RSAES-OAEP-Decrypt</a></h4>

<ul>
<li>&#x68C0;&#x67E5;&#x957F;&#x5EA6;&#x662F;&#x5426;&#x6EE1;&#x8DB3;&#x4EE5;&#x4E0B;&#x8981;&#x6C42;:
<ul>
<li><span class="mathjax-exps">$len(L)$</span>&#x7684;&#x957F;&#x5EA6;&#x9700;&#x8981;&#x5C0F;&#x4E8E;Hash&#x51FD;&#x6570;&#x5BF9;&#x8F93;&#x5165;&#x516B;&#x4F4D;&#x4E32;&#x957F;&#x5EA6;&#x7684;&#x9650;&#x5236;;</li>
<li><span class="mathjax-exps">$len(C) = len(n)$</span>;</li>
<li><span class="mathjax-exps">$len(n) \ge (2*len(HashVal) + 2)$</span>;</li>
</ul>
</li>
<li>RSA&#x89E3;&#x5BC6;:
<ul>
<li><span class="mathjax-exps">$c=OS2IP(C)$</span>;</li>
<li><span class="mathjax-exps">$m = RSADP(c)$</span>;</li>
<li><span class="mathjax-exps">$EM = truncate_{len(n)}(I2OSP(m))$</span>;</li>
</ul>
</li>
<li>EME-OAEP&#x89E3;&#x7801;:
<ul>
<li><span class="mathjax-exps">$lval = Hash(L)$</span>;</li>
<li><span class="mathjax-exps">$EM = Y || maskedSeed || maskedDB$</span>;</li>
<li><span class="mathjax-exps">$seedMask = MGF(maskedDB, len(HashVal))$</span>;</li>
<li><span class="mathjax-exps">$seed = maskedSeed \oplus seedMask$</span>;</li>
<li><span class="mathjax-exps">$dbMask = MGF(seed, len(n)-len(HashVal)-1)$</span>;</li>
<li><span class="mathjax-exps">$DB = maskedDB \oplus dbMask$</span>;</li>
<li><span class="mathjax-exps">$DB = lval^{&apos;} || PS || Z || M$</span>;</li>
</ul>
</li>
<li>&#x68C0;&#x67E5;&#x683C;&#x5F0F;&#x662F;&#x5426;&#x5408;&#x6CD5;:
<ul>
<li><span class="mathjax-exps">$Y = 0x00$</span>;</li>
<li><span class="mathjax-exps">$lval = lval^{&apos;}$</span>;</li>
<li><span class="mathjax-exps">$Z = 0x01$</span>;</li>
</ul>
</li>
<li>&#x8F93;&#x51FA;<span class="mathjax-exps">$M$</span>;</li>
</ul>
<h3 class="mume-header" id="rsaes-pkcs1_v15toc"><a href="#toc">RSAES-PKCS1_v1.5</a></h3>

<h4 class="mume-header" id="rsaes-pkcs1_v15-encrypttoc"><a href="#toc">RSAES-PKCS1_v1.5-Encrypt</a></h4>

<ul>
<li>&#x68C0;&#x67E5;&#x6D88;&#x606F;&#x957F;&#x5EA6;&#x662F;&#x5426;&#x5408;&#x89C4;:
<ul>
<li><span class="mathjax-exps">$len(M) \le (len(n) - 11)$</span>;</li>
</ul>
</li>
<li>EME-PKCS1-v1.5&#x7F16;&#x7801;:
<ul>
<li>&#x968F;&#x673A;&#x751F;&#x6210;&#x5404;&#x5B57;&#x8282;&#x90FD;&#x975E;0&#x7684;&#x516B;&#x4F4D;&#x4E32;: <span class="mathjax-exps">$PS,\quad len(PS) = len(n)-len(M)-3$</span>;</li>
<li><span class="mathjax-exps">$EM = 0x00||0x02||PS||0x00||M$</span>;</li>
</ul>
</li>
<li>RSA&#x52A0;&#x5BC6;:
<ul>
<li><span class="mathjax-exps">$m=OS2IP(EM)$</span>;</li>
<li><span class="mathjax-exps">$c = RSAEP(m)$</span>;</li>
<li><span class="mathjax-exps">$C = I2OSP(c)$</span>;</li>
</ul>
</li>
<li>&#x8F93;&#x51FA;<span class="mathjax-exps">$C$</span>;</li>
</ul>
<h4 class="mume-header" id="rsaes-pkcs_v15-decrypttoc"><a href="#toc">RSAES-PKCS_v1.5-Decrypt</a></h4>

<ul>
<li>&#x68C0;&#x67E5;&#x5BC6;&#x6587;&#x957F;&#x5EA6;&#x662F;&#x5426;&#x5408;&#x89C4;:
<ul>
<li><span class="mathjax-exps">$len(C) = len(n), len(n) \ge 11$</span>;</li>
</ul>
</li>
<li>RSA&#x89E3;&#x5BC6;:
<ul>
<li><span class="mathjax-exps">$c = OS2IP(C)$</span>;</li>
<li><span class="mathjax-exps">$m = RSADP(c)$</span>;</li>
<li><span class="mathjax-exps">$EM = I2OSP(m)$</span>;</li>
</ul>
</li>
<li>EME-PKCS1-v1.5&#x89E3;&#x7801;:
<ul>
<li><span class="mathjax-exps">$EM= X||Y||PS||Z||M$</span>;</li>
<li>&#x68C0;&#x67E5;&#x89E3;&#x7801;&#x683C;&#x5F0F;&#x662F;&#x5426;&#x5408;&#x89C4;:
<ul>
<li><span class="mathjax-exps">$X = 0x00, Y=0x02, Z=0x00$</span>;</li>
</ul>
</li>
</ul>
</li>
<li>&#x8F93;&#x51FA;<span class="mathjax-exps">$M$</span>;</li>
</ul>
<h2 class="mume-header" id="%E7%AD%BE%E5%90%8D%E6%96%B9%E6%A1%88toc"><a href="#toc">&#x7B7E;&#x540D;&#x65B9;&#x6848;</a></h2>

<h3 class="mume-header" id="rsassa-psstoc"><a href="#toc">RSASSA-PSS</a></h3>

<h4 class="mume-header" id="rsassa-pss-signtoc"><a href="#toc">RSASSA-PSS-Sign</a></h4>

<ul>
<li>EMSA-PSS&#x7F16;&#x7801;:
<ul>
<li><span class="mathjax-exps">$EM = EMSA-PSS-Encode(M, bitslen(n)-1)$</span>;</li>
</ul>
</li>
<li>RSA&#x7B7E;&#x540D;:
<ul>
<li><span class="mathjax-exps">$m = OS2IP(EM)$</span>;</li>
<li><span class="mathjax-exps">$s = RSASP1(m)$</span>;</li>
<li><span class="mathjax-exps">$S = truncate_{len(n)}(I2OSP(s))$</span>;</li>
</ul>
</li>
</ul>
<h4 class="mume-header" id="rsassa-pss-verifytoc"><a href="#toc">RSASSA-PSS-Verify</a></h4>

<ul>
<li>&#x68C0;&#x67E5;&#x7B7E;&#x540D;&#x957F;&#x5EA6;:
<ul>
<li><span class="mathjax-exps">$len(S) = len(n)$</span>;</li>
</ul>
</li>
<li>RSA&#x7B7E;&#x540D;&#x9A8C;&#x8BC1;:
<ul>
<li><span class="mathjax-exps">$s = OS2IP(S)$</span>;</li>
<li><span class="mathjax-exps">$m = RSAVP1(s)$</span>;</li>
<li><span class="mathjax-exps">$EM = trancate_{emLen}(I2OSP(m)), emLen = \lceil (bitslen(n) - 1) / 8 \rceil$</span>;</li>
</ul>
</li>
<li>EMSA-PSS&#x9A8C;&#x8BC1;:
<ul>
<li><span class="mathjax-exps">$EMSA-PSS-Verify(M, EM, bitslen(n) - 1)$</span>;</li>
</ul>
</li>
</ul>
<h3 class="mume-header" id="rsassa-pkcs1-v15toc"><a href="#toc">RSASSA-PKCS1-v1.5</a></h3>

<h4 class="mume-header" id="rsassa-pkcs1-v15-signtoc"><a href="#toc">RSASSA-PKCS1-v1.5-Sign</a></h4>

<ul>
<li>EMSA-PKCS1-v1.5&#x7F16;&#x7801;:
<ul>
<li><span class="mathjax-exps">$EM = EMSA-PKCS1-v1.5-Encode(M)$</span>;</li>
</ul>
</li>
<li>RSA&#x7B7E;&#x540D;:
<ul>
<li><span class="mathjax-exps">$m = OS2IP(EM)$</span>;</li>
<li><span class="mathjax-exps">$s = RSASP1(m)$</span>;</li>
<li><span class="mathjax-exps">$S = I2OSP(s)$</span>;</li>
</ul>
</li>
</ul>
<h4 class="mume-header" id="rsassa-pkcs1-v15-verifytoc"><a href="#toc">RSASSA-PKCS1-v1.5-Verify</a></h4>

<ul>
<li>&#x68C0;&#x67E5;<span class="mathjax-exps">$len(S) = len(n)$</span></li>
<li>RSA&#x9A8C;&#x8BC1;:
<ul>
<li><span class="mathjax-exps">$s = OS2IP(S)$</span>;</li>
<li><span class="mathjax-exps">$m = RSAVP1(S)$</span>;</li>
<li><span class="mathjax-exps">$EM = I2OSP(m)$</span>;</li>
</ul>
</li>
<li>EMSA-PKCS1-v1.5&#x7F16;&#x7801;:
<ul>
<li><span class="mathjax-exps">$EM&apos; = EMSA-PKCS1-v1.5-Encode(M)$</span>;</li>
<li>&#x68C0;&#x67E5;<span class="mathjax-exps">$EM = EM&apos;$</span>;</li>
</ul>
</li>
</ul>
<h3 class="mume-header" id="emsa-psstoc"><a href="#toc">EMSA-PSS</a></h3>

<ul>
<li><span class="mathjax-exps">$emBits$</span>: <span class="mathjax-exps">$OS2IP(EM)$</span>&#x7684;&#x6700;&#x5927;&#x4F4D;&#x957F;&#x5EA6;, <span class="mathjax-exps">$emLen = \lceil emBits/8 \rceil$</span>;</li>
<li><span class="mathjax-exps">$sLen$</span>: salt&#x7684;&#x5B57;&#x8282;&#x957F;&#x5EA6;;</li>
</ul>
<h4 class="mume-header" id="emsa-pss-encodetoc"><a href="#toc">EMSA-PSS-Encode</a></h4>

<ul>
<li><code>EMSA-PSS-Encode(M, emBits)</code>:
<ul>
<li>&#x68C0;&#x67E5;&#x6D88;&#x606F;&#x7684;&#x957F;&#x5EA6;&#x662F;&#x5426;&#x5408;&#x89C4;:
<ul>
<li><span class="mathjax-exps">$len(M)$</span>&#x5C0F;&#x4E8E;Hash&#x51FD;&#x6570;&#x7684;&#x6700;&#x5927;&#x8F93;&#x5165;&#x4E32;&#x7684;&#x957F;&#x5EA6;;</li>
<li><span class="mathjax-exps">$emLen \ge (len(HashVal) + sLen + 2$</span>;</li>
</ul>
</li>
<li><span class="mathjax-exps">$mHash = Hash(M)$</span>;</li>
<li>&#x968F;&#x673A;&#x751F;&#x6210;&#x957F;&#x5EA6;&#x4E3A;<span class="mathjax-exps">$sLen$</span>&#x7684;salt&#x5B57;&#x7B26;&#x4E32;;</li>
<li><span class="mathjax-exps">$M&apos; = 0x00||0x00||0x00||0x00||0x00||0x00||0x00||0x00||mHash||salt$</span>;</li>
<li><span class="mathjax-exps">$H = Hash(M&apos;)$</span>;</li>
<li><span class="mathjax-exps">$PS = 0||\dots||0, len(PS)=emLen - sLen - len(H) - 2$</span>;</li>
<li><span class="mathjax-exps">$DB = PS || 0x01 || salt$</span>;</li>
<li><span class="mathjax-exps">$dBMask = MGF(H, emLen - len(H) - 1)$</span>;</li>
<li><span class="mathjax-exps">$maskedDB = DB\oplus dbMask$</span>;</li>
<li>&#x5C06;<span class="mathjax-exps">$maskedDB$</span>&#x6700;&#x5DE6;&#x8FB9;&#x7684;<span class="mathjax-exps">$8*emLen - emBits$</span>&#x7684;&#x5404;&#x4F4D;&#x66FF;&#x6362;&#x4E3A;0;</li>
<li><span class="mathjax-exps">$EM = maskedDB || H || 0xbc$</span>;</li>
<li>&#x8F93;&#x51FA;EM;</li>
</ul>
</li>
</ul>
<h4 class="mume-header" id="emsa-pss-verifytoc"><a href="#toc">EMSA-PSS-Verify</a></h4>

<ul>
<li><code>EMSA-PSS-Verify(M, EM, emBits)</code>:
<ul>
<li>&#x68C0;&#x67E5;&#x6D88;&#x606F;&#x7684;&#x957F;&#x5EA6;&#x662F;&#x5426;&#x5408;&#x89C4;:
<ul>
<li><span class="mathjax-exps">$len(M)$</span>&#x5C0F;&#x4E8E;Hash&#x51FD;&#x6570;&#x7684;&#x6700;&#x5927;&#x8F93;&#x5165;&#x4E32;&#x7684;&#x957F;&#x5EA6;;</li>
<li><span class="mathjax-exps">$emLen \ge (len(HashVal) + sLen + 2$</span>;</li>
</ul>
</li>
<li>&#x68C0;&#x67E5;<span class="mathjax-exps">$EM$</span>&#x6700;&#x53F3;&#x8FB9;&#x7684;&#x5B57;&#x8282;&#x662F;&#x5426;&#x4E3A;<span class="mathjax-exps">$0xbc$</span>;</li>
<li><span class="mathjax-exps">$EM = maskedDB || H, len(maskedDB) = emLen - len(HashVal) - 1$</span>;</li>
<li>&#x68C0;&#x67E5;<span class="mathjax-exps">$maskedDB$</span>&#x6700;&#x5DE6;&#x8FB9;&#x7684;<span class="mathjax-exps">$8*emLen - emBits$</span>&#x7684;&#x5404;&#x4F4D;&#x662F;&#x5426;&#x4E3A;0;</li>
<li><span class="mathjax-exps">$dbMask = MGF(H, emLen - len(H) - 1)$</span>;</li>
<li><span class="mathjax-exps">$DB = maskedDB \oplus dbMask$</span>;</li>
<li>&#x5C06;<span class="mathjax-exps">$DB$</span>&#x7684;&#x6700;&#x5DE6;&#x8FB9;&#x7684;<span class="mathjax-exps">$8*emLen - emBits$</span>&#x7684;&#x5404;&#x4F4D;&#x66FF;&#x6362;&#x4E3A;0;</li>
<li><span class="mathjax-exps">$DB = X||Y||salt, len(X) = emLen-len(H)-sLen-2, len(Y)=1$</span>;</li>
<li>&#x68C0;&#x67E5;<span class="mathjax-exps">$X$</span>&#x7684;&#x5404;&#x4F4D;&#x662F;&#x5426;&#x4E3A;0, &#x4E14;<span class="mathjax-exps">$Y=0x01$</span>;</li>
<li><span class="mathjax-exps">$M&apos; = 0x00||0x00||0x00||0x00||0x00||0x00||0x00||0x00||mHash||salt$</span>;</li>
<li><span class="mathjax-exps">$H&apos; = Hash(M&apos;)$</span>;</li>
<li>&#x68C0;&#x67E5;&#x662F;&#x5426;&#x6EE1;&#x8DB3;<span class="mathjax-exps">$H = H&apos;$</span>;</li>
</ul>
</li>
</ul>
<h3 class="mume-header" id="emsa-pkcs1-v15toc"><a href="#toc">EMSA-PKCS1-v1.5</a></h3>

<h4 class="mume-header" id="emsa-pkcs1-v15-encodetoc"><a href="#toc">EMSA-PKCS1-v1.5-Encode</a></h4>

<ul>
<li>&#x68C0;&#x67E5;&#x6D88;&#x606F;&#x7684;&#x957F;&#x5EA6;&#x662F;&#x5426;&#x5408;&#x89C4;:
<ul>
<li><span class="mathjax-exps">$len(M)$</span>&#x5C0F;&#x4E8E;Hash&#x51FD;&#x6570;&#x7684;&#x6700;&#x5927;&#x8F93;&#x5165;&#x4E32;&#x7684;&#x957F;&#x5EA6;;</li>
</ul>
</li>
<li><span class="mathjax-exps">$H = Hash(M)$</span>;</li>
<li><code>DER(Distinguished Encoding Rules)</code>:</li>
</ul>
<pre data-role="codeBlock" data-info="txt" class="language-txt"><code>DigestInfo ::= SEQUENCE {
  digestAlgorithm AlgorithmIdentifier,
  digest OCTET STRING
}
</code></pre><ul>
<li>&#x68C0;&#x67E5;<span class="mathjax-exps">$emLen \ge (len(DigestInfo) + 11)$</span>;</li>
<li><span class="mathjax-exps">$PS=0xff||\dots||0xff,\quad len(PS) = emLen - len(DigestInfo) - 3$</span>;</li>
<li><span class="mathjax-exps">$EM = 0x00 || 0x01 || PS || 0x00 || DigestInfo$</span>;</li>
<li>&#x8F93;&#x51FA;<span class="mathjax-exps">$EM$</span>;</li>
</ul>
<h2 class="mume-header" id="mgftoc"><a href="#toc">MGF</a></h2>

<p>PKCS#1 v2.2&#x4E2D;&#x5B9A;&#x4E49;&#x4E86;&#x63A9;&#x7801;&#x751F;&#x6210;&#x51FD;&#x6570;MGF1, &#x5176;&#x548C;&#x6807;&#x51C6;IEEE 1363-2000, ANSI X9.44-2007&#x4E2D;&#x7684;&#x4E00;&#x81F4;;</p>
<ul>
<li><span class="mathjax-exps">$MGF1(seed, olen)$</span>:
<ul>
<li><span class="mathjax-exps">$olen$</span>&#x8868;&#x793A;&#x63A9;&#x7801;&#x51FD;&#x6570;&#x8F93;&#x51FA;&#x5B57;&#x4E32;&#x7684;&#x957F;&#x5EA6;, &#x9700;&#x6EE1;&#x8DB3;<span class="mathjax-exps">$olen\lt 2^{32}\cdot len(HashVal)$</span>;</li>
<li>&#x521D;&#x59CB;&#x5316;<span class="mathjax-exps">$T$</span>&#x4E3A;&#x7A7A;&#x4E32;;</li>
<li><span class="mathjax-exps">$T = T || Hash(seed || truncate_4(I2OSP(i)))\quad for\ i\ from\ 0\ to\ \lceil olen/len(HashVal) \rceil - 1$</span>;</li>
<li><span class="mathjax-exps">$truncate_{olen}(T)$</span>;</li>
</ul>
</li>
</ul>
<h2 class="mume-header" id="%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99toc"><a href="#toc">&#x53C2;&#x8003;&#x8D44;&#x6599;</a></h2>

<ul>
<li>PKCS#1 v2.2: RSA Cryptography Standard;</li>
</ul>

      </div>
      
      
    
    
    
    
    
    
    
    
  
    </body></html>